package edu.ccut.saturn.basecomponent.baseservicecomponent;
/**
 * 将字典动态加到内存
 */
import java.util.List;

import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IDataDictTypeInfo;
import edu.ccut.saturn.component.IDictItemInfo;
import edu.ccut.saturn.component.IParameterContext;
import edu.ccut.saturn.component.SaturnDictionaryManager;

public class InsertRunTimeDict extends DefaultComponent {
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {
		String dictname = (String)parameterContext.getParameterValue(0);//"qx_usertype";
		String dictcode= (String)parameterContext.getParameterValue(1);
		String dictvalue = (String)parameterContext.getParameterValue(2);
		String py = (String)parameterContext.getParameterValue(3);
		
		IDataDictTypeInfo info = SaturnDictionaryManager.getInstance().getDataDictTypeInfo(dictname);
		List<IDictItemInfo> items = info.getItems();
		IDictItemInfo item =SaturnDictionaryManager.getInstance().CreateDictItemInfo();
		item.setType(dictname);
		item.setCode(dictcode);
		item.setValue(dictvalue);
		item.setPinyin(py);
		items.add(item);
	}
}